package com.zwz.controller;

import com.zwz.dto.DishonestPersonDTO;
import com.zwz.entity.DishonestPerson;
import com.zwz.service.DishonestPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/dishonest-persons")
public class DishonestPersonController {

    @Autowired
    private DishonestPersonService service;

    @PostMapping
    public ResponseEntity<?> create(String enterpriseId) {
        try {
            DishonestPersonDTO dto = service.createWithMain(enterpriseId);
            return ResponseEntity.status(HttpStatus.CREATED).body(dto);
        } catch (IllegalArgumentException e) {
            return ResponseEntity.badRequest().body(e.getMessage());
        }
    }

//    @GetMapping("/current")
//    public ResponseEntity<List<DishonestPerson>> getCurrent() {
//        return ResponseEntity.ok(service.getCurrentDishonest());
//    }
//
//    @GetMapping("/case/{caseNumber}")
//    public ResponseEntity<List<DishonestPerson>> getByCase(
//            @PathVariable String caseNumber) {
//        return ResponseEntity.ok(dishonestMapper.selectByCaseNumber(caseNumber));
//    }
}